package com.example.xiaoxueqixiangmu.Tabs;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

import com.example.xiaoxueqixiangmu.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class OrderActivity extends AppCompatActivity {
    private Button btn_daizhifu,btn_allzhifu;
 /*   private List<HashMap<String, Object>> dataList;
    private SimpleAdapter adapter;
    private ListView listView;*/

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order);
        btn_daizhifu=findViewById(R.id.btn_daizhifu);
        btn_allzhifu=findViewById(R.id.btn_allzhifu);
        btn_daizhifu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //跳转一个布局文件
            }
        });
        btn_allzhifu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //跳转另一个布局文件。
            }
        });

        /*dataList = new ArrayList<HashMap<String, Object>>();
        HashMap<String, Object> map;
        for (int i = 0; i < 10; i++) {
            map = new HashMap<String, Object>();
            map.put("checi", "2021#YQ");
            map.put("cheming", "DAJSH");
            map.put("riqi", "2021-4-4");
            map.put("dizhi", "第" + (i + 1) + "沈阳->上海");
            map.put("zhifuYN", "已支付");
            map.put("price", "70");
            map.put("image", R.drawable.forward_25);
            dataList.add(map);
        }

            Log.d("list",dataList.size()+"");

            adapter = new SimpleAdapter(this, dataList, R.layout.order_list_item_layout,
                    new String[]{"checi", "cheming", "riqi", "dizhi", "zhifuYN", "price", "image"}, new
                    int[]{R.id.tv_checi, R.id.tv_cheming, R.id.riqi, R.id.dizhi, R.id.zhifuYN, R.id.price, R.id.imageView});
            listView = findViewById(R.id.listView);
            listView.setAdapter(adapter);

            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    Toast.makeText(OrderActivity.this, "你点击了第一项", Toast.LENGTH_SHORT).show();
                }
            });*/


    }
}